// LizardShExt.h : Declaration of the CLizardShExt

#pragma once
#include "resource.h"       // main symbols

#include "CLizardShExt.h"

#include <shlobj.h>
#include <shlguid.h>
#include <comdef.h>
#include "LizardClient.h"
#include "atlcoll.h"

//extern"C"{
//#include <iostream>
//};



#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif



// CLizardShExt

class ATL_NO_VTABLE CLizardShExt :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CLizardShExt, &CLSID_LizardShExt>,
  public IShellExtInit,
	public IContextMenu,
	public IColumnProvider

{
	public:
		CLizardShExt()
		{
			iigdCount=0;
			fiInfos.lastFileInfoPath="";
			usedFileLists[0]= CComBSTR("");
			usedFileLists[1]= CComBSTR("");
			usedFileLists[2]= CComBSTR("");
			usedFileLists[3]= CComBSTR("");
			usedFileLists[4]= CComBSTR("");
		}
	protected:
		// {40FD4BB2-5D10-4aec-BC4C-594D372A2042}

	  TCHAR m_szFile[MAX_PATH];
	  CAtlList<CComBSTR, CStringRefElementTraits<CComBSTR> > lstFiles;
	  CComBSTR paths;
		CLizardClient client;
		int iigdCount;
		FileInfos fiInfos;
		
//		CLSID lizardsheGUID ("{40FD4BB2-5D10-4aec-BC4C-594D372A2042}");
//		CLSID lizardsheGUID (0x40fd4bb2, 0x5d10, 0x4aec, 0xbc, 0x4c, 0x59, 0x4d, 0x37, 0x2a, 0x20, 0x42);
		
	public:
	  // IShellExtInit
	  STDMETHODIMP Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY);

	public:
	  // IContextMenu
	  STDMETHODIMP GetCommandString(UINT_PTR, UINT, UINT*, LPSTR, UINT);
	  STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO);
	  STDMETHODIMP QueryContextMenu(HMENU, UINT, UINT, UINT, UINT);

	public:
	//IColumnProvider 

	  STDMETHODIMP Initialize(LPCSHCOLUMNINIT psci) { return S_OK; }
	  STDMETHODIMP GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO* psci);
	  STDMETHODIMP GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd,
							   VARIANT* pvarData);

public:
	DECLARE_REGISTRY_RESOURCEID(IDR_LIZARDSHEXT)

	DECLARE_NOT_AGGREGATABLE(CLizardShExt)

	BEGIN_COM_MAP(CLizardShExt)
		COM_INTERFACE_ENTRY(IShellExtInit)
		COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
    COM_INTERFACE_ENTRY_IID(IID_IColumnProvider, IColumnProvider)

	END_COM_MAP()



		DECLARE_PROTECT_FINAL_CONSTRUCT()

		HRESULT FinalConstruct()
		{
			return S_OK;
		}

		void FinalRelease()
		{
		}

	public:

private:
	
	UINT_PTR menuItemsCount;
	CComBSTR usedFileLists[5];
};




OBJECT_ENTRY_AUTO(__uuidof(LizardShExt), CLizardShExt)


 

